<?php


namespace app\common\status;


class StatusCode
{
    const SUCCESS = 200;
    const BAD_REQUEST = 400;
    const UNAUTHORIZED = 401;
    const SERVER_ERROR = 500;

    public static $messages
        = [
            self::AUTH_ERROR => '用户名或密码错误',
            self::PERMISSION_ERROR => '无权进行此操作',
            self::ADMIN_IS_GOD => '不能对超级管理员进行此操作',
            self::ADD_ROLE_FAILE => '分配角色失败',
            self::BIND_SHOP_FAILE => '绑定门店失败',
            self::PHONE_CODE_INVALID => '无效的验证码，请重新获取',
            self::PHONE_CODE_ERROR => '验证码输入错误',
            self::ORIGINAL_PASSWORD_ERROR => '原密码不正确',
            self::PASSWORD_LENGTH_SIX => '密码最少 6 位数',
            self::IMAGE_INVALID => '当前文件后缀不被允许',
            self::SYSTEM_INVALID => 'Server Error系统服务异常:缺少必要参数',
            self::SORT_INVALID => '权重值只能在 0-100 范围内',
            self::PARAMS_INVALID => '参数校验错误',
            self::TIME_INVALID => '所选择的时间不正确',
            self::NOT_EXIST => '当前条目不存在',
            self::NOT_IN_FORCE => '操作未生效',
            self::FORBID_BIND => '当前账号或店铺已进行过绑定，不能重复绑定',
            self::PRICE_INVALID => '商品活动价不能大于等于划线价',
            self::PHONE_EXIST => '手机号已经存在',
            self::SERVER_ERROR => 'Server Error',
            self::DELETE_REFUSE => '目前不能执行删除操作，该项正被使用中，可能存在子项,或已售出',
            self::GOODS_IN_ACTIVITY => '检测到所选商品已存在于其他活动中，不能再被添加到专题活动',
            self::COOKBOOK_DELETE => '已启用的菜谱不能执行删除操作',
            self::GOODS_UNIT_DELETE => '该单位下存在商品不能执行删除操作',
            self::CATEGORY_DELETE => '分类下存在商品，不能删除',
            self::FORBID_UPDATE_GOODS => '该商品已产生订单，不能被编辑或删除',
            self::TAG_INCLUDE_MEMBER => '该标签下有会员,不能删除',
            self::SHARER_TEAM_LEADER_STATUS_FAILED => '分享人当前还不是团长，请到个人中心自行申请团长',
            self::TEAM_LEADER_STATUS_FAILED => '该用户当前还不是团长',
            self::HAS_BEEN_TEAM_LEADER => '您已经是团长了，不能重复申请',
            self::WITHDRAW_CERTIFICATE_INVALID => '请上传转账凭证',
            self::BALANCE_OF_ACCOUNT_INSUFFICIENT => '提现金额不能大于用户已申请金额总计',
            self::TEAMLEADE_STATUS_REJECT => '驳回操作请填写驳回原因',
            self::TEAMLEADE_STATUS_SUBMIT => '团长申请已提交，请耐心等待审核',
            self::TEAMLEADE_STATUS_CAN_NOT_CHECK => '当前用户没有提交审核请求，不能进行审核操作',
            self::TEAMLEADE_WITHDRAW_AMOUNT_ERROR => '提现金额不能小于 100 元',
            self::INSUFFICIENT_ACCOUNT_BALANCE => '账户余额不足',
            self::ORDER_VERIFICATION_STATUS => '当前订单已经被核销过了',
            self::CAN_T_ADVANCE_TAKE => '无法进行提前核销',
            self::WRITE_OFF_DATA_IS_ILLEGAL => '核销数据不合法',
            self::LEADER_INCOMPLETE_INFORMATION => '该团长资料不全，还不能营业',
            self::SAME_TIME_AND_SHOP => '当前活动的时间和其它活动时间重叠，且存在相同的店铺',
            self::ERROR_TYPE => '传输类型错误',
            self::ERROR_USERNAME => '用户不存在',
            self::ERROR_PASSWORD => '密码输入有误',
            self::NOT_HAVE_NEAR_SHOP => '附近没有店铺',
            self::MISSING_PARAMETER => '参数不正确',
            self::EMPTY_PHONE => '请输入手机号',
            self::PHONE_ERROR => '请输入正确的手机号',
            self::NOT_CONTENT_CHANGE => '内容未发生改变,请修改后在提交',
            self::ERROR_BY_USER_BY_SHOP => '该用户没有跟店铺绑定,请联系平台管理员',
            self::GOODS_NUM_OVER => '超出限购数量',
            self::GOODS_INVALID => '商品已失效',
            self::GOODS_SELL_OUT_PART => '部分商品已失效',
            self::GOODS_SELL_OUT => '亲该商品已售罄哦~',
            self::CART_NULL => '购物车没有商品信息',
            self::CART_NOT_SELECTED => '购物车商品未勾选',
            self::CART_CLEAR_FAIL => '购物车清空失败',
            self::SESSION_CODE_ERROR => 'Code换取SessionKey失败',
            self::ORDER_DEAL_ERROR => '配送方式异常',
            self::ORDER_ADDRESS_ERROR => '收货地址不能为空',
            self::ORDER_PRICE_ERROR => '支付金额有误',
            self::ORDER_PAY_TYPE_ERROE => '支付方式有误',
            self::SHOP_STATUS_ERROR => '该门店不在营业时间内',
            self::SHOP_STATUS_CLOSE => '该门店暂不营业',
            self::SHOP_DEAL_TYPE => '该门店只能自提',
            self::SHOP_AREA_ERROR => '超出店铺配送范围',
            self::NOT_SETTLE => '暂无结算商品',
            self::ACTIVITY_CAN_NOT_EDIT => '当前活动正在进行中，或已禁用，不可编辑',
            self::CRD_GOODS_NUM_OVER => '每人每天限购',
            self::GOODS_SEARCH_ERROR => '搜索不能为空',
            self::CRD_GOODS_BEYOND_LIMIT_NUM => '次日达订单列表立即支付超出限购',
            self::SHOP_MONEY_ERROR => '商品金额有误',
            self::ERROR_BY_PASSWORD => '原密码与新密码相同',
            self::LEADER_ERROR => '团长信息不存在',
            self::SALE_GOODS_INVALID => '秒杀商品已下架',
            self::SALE_STOCK_INVALID => '秒杀商品库存不足',
            self::GOODS_DELETE => '店铺商品已删除',
            self::GOODS_STATUS => '店铺商品已下架',
            self::GOODS_PLATFORM_STATUS => '平台商品已下架'
        ];

    public static function getMessage($code)
    {
        $message = ErrorCode::$messages[$code] ?? '未知错误';

        return $message;
    }
}
